// 处理轮播图数据 函数
import { ref, onMounted } from 'vue'
import { getBannerService } from '@/api/layout'

export const useBanner = () => {
  // 获取轮播图数据
  const bannerList = ref([])

  const getBanner = async () => {
    const res = await getBannerService({ distributionSite: '2' })
    // console.log(res.data.result)
    bannerList.value = res.data.result
  }

  // 一进页面就调用
  onMounted(() => {
    getBanner()
  })

  // 暴露出去
  return {
    bannerList,
  }
}
